//后台数据
const loginArr = [{
    username: 'admin',
    pwd: 123,
    tel: 13723017723,
    address: '北京 昌平',
    token: 'admin---token'
}, {
    username: 'user',
    pwd: 123456,
    tel: 13723017723,
    address: '北京 昌平',
    token: 'user---token'
}]
export default {
    loginApi: config => {
        var { username, pwd } = JSON.parse(config.body);
        var obj = loginArr.find(item => {
            return item.username == username && item.pwd == pwd;
        })
        if (!obj) { //没找到账号
            return {
                code: 201,
                msg: '账号密码不存在',
                data: null
            }
        } else {
            return {
                code: 200,
                msg: '账号密码不存在',
                data: obj.token
            }
        }
        return {
            code: 200,
            msg: '登录成功',
            data: null
        }
    }
}